<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="javax.transaction.*" %>
<%@ page import="javax.sql.*" %>
<%@ taglib uri="/WEB-INF/holly-unicom-sheet.tld" prefix="unicom-sheet"%>
<%
try {
javax.naming.Context ctx = new javax.naming.InitialContext();
out.println("Object: " + ctx.lookup("javax/transaction/UserTransaction"));
out.println("<br>\n");
out.println("Object: " + ctx.lookup("jdbc/unicomapp"));


javax.transaction.UserTransaction tx = (javax.transaction.UserTransaction) ctx.lookup("javax/transaction/UserTransaction");
javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup("jdbc/unicomapp");
java.sql.Connection con = null;
try {
    tx.begin();
	con = ds.getConnection();
	out.println("ds: " + con);
    java.sql.PreparedStatement stmt = con.prepareStatement("select * from tbl_users where user_code = ?");
    //stmt.setCharacterStream(1, new java.io.StringReader("0994        "), 12);
    stmt.setObject(1, "0994         ", java.sql.Types.CHAR);
    //stmt.setString(1, "0994        ");
    out.println("createStatement ok.");
    java.sql.ResultSet rs = stmt.executeQuery();
    out.println("executeQuery ok.\n<hr>");

    while (rs.next()) {
        out.println(rs.getString(1));
        out.println(rs.getString(2));
    }

    tx.commit();

    com.hollycrm.unicom.sequenceservice.SequenceManager sm =
    (com.hollycrm.unicom.sequenceservice.SequenceManager) com.hollycrm.springframework.factory.DefaultBeanFactory.getBean("sequenceManager");

    out.println("nextSequence: " + sm.nextSequence("TEST") + "<hr>\n");

	com.hollycrm.springframework.cache.CacheDepthUtil.put("apple", "apple...");
    out.println("getKey: " + com.hollycrm.springframework.cache.CacheDepthUtil.get("apple") + "<br>");

    java.util.List listValue = new java.util.ArrayList();
    listValue.add(new com.hollycrm.unicom.common.LabelValueBean("key", "value"));
    listValue.add(new com.hollycrm.unicom.common.LabelValueBean("key1", "value1"));
    listValue.add(new com.hollycrm.unicom.common.LabelValueBean("key2", "value2"));
    listValue.add(new com.hollycrm.unicom.common.LabelValueBean("key3", "value3"));

    com.hollycrm.springframework.cache.CacheDepthUtil.putList("apple", listValue, "label");

    java.util.List cList = com.hollycrm.springframework.cache.CacheDepthUtil.getList("apple");
    out.println("cList: " + cList);

	out.println("<hr>\n");
	out.println("PRINT_TITLE: " + com.hollycrm.unicom.sheet.Constants.getValue("PRINT_TITLE"));

    out.println("<hr>\n");
    out.println("codeManager1: " + ((com.hollycrm.unicom.sheet.code.CodeManager)
    com.hollycrm.springframework.factory.DefaultBeanFactory.getBean("codeManager")).getDepartmentTreeList());

	((com.hollycrm.springframework.cache.Cache)( (com.hollycrm.springframework.cache.CacheFactory) com.hollycrm.springframework.factory.DefaultBeanFactory.getBean(com.hollycrm.springframework.cache.CacheFactory.BEAN_ID)).buildCache("sheetCategoryRegion")).clear();

}
catch (Exception e) {
    //tx.rollback();
    e.printStackTrace();
}
finally {
	con.close();
}
}
catch (Exception e) {
 	e.printStackTrace();
}

%>
<hr/>
<unicom-sheet:deptLabel deptKey="00541A14053244D6AD4ADC89C02646F8"/>
<hr/>
<unicom-sheet:codeLabel codeType="BUSINESS_TYPE" codeKey="02" codeKeyProperty=""/>
<hr/>
<unicom-sheet:classLabel problemKey="030110"/>
<hr/>
<unicom-sheet:categoryLabel categoryKey="1"/>
<hr/>getProblemTemplate:
<%=
((com.hollycrm.unicom.sheet.code.CodeManager)com.hollycrm.springframework.factory.DefaultBeanFactory.getBean("codeManager")).getProblemTemplate("030110")
%>
<hr/>

<hr/>
<unicom-sheet:codeLabel codeType="SHEET_STATUS" codeKey="00"/>
